#ifndef _CLIENT_H
#define _CLIENT_H

#include <upnp/ixml.h>


/************************* STA9ERES ************************
 * Parakatw dhlwnontai oi sta9eres pou xreiazontai	   *
 ***********************************************************/
/** Eidh mhnumatwn **/
#define INFORM 10
#define INFORMRESPONSE 15
#define GETPARAMETERVALUES 20
#define GETPARAMETERVALUESRESPONSE 25
#define SETPARAMETERVALUES 30
#define SETPARAMETERVALUESRESPONSE 35
#define GETPARAMETERNAMES 40
#define GETPARAMETERNAMESRESPONSE 45
#define REBOOT 50
#define REBOOTRESPONSE 55
#define DOWNLOAD 60
#define DOWNLOADRESPONSE 65
#define UPLOAD 70
#define UPLOADRESPONSE 75
#define GETRPCMETHODS 80
#define GETRPCMETHODSRESPONSE 85
#define NOTIMPLEMENTEDMESSAGE 150



/** Eidh la9wn **/
#define METHOD_NOT_SUPPORTED 9000
#define REQUEST_DENIED 9001
#define INTERNAL_ERROR 9002
#define INVALID_ARGUMENTS 9003
#define RESOURCES_EXCEEDED 9004
#define INVALID_PARAMETER_NAME 9005
#define INVALID_PARAMETER_TYPE 9006
#define INVALID_PARAMETER_VALUE 9007
#define ATTEMPT_TO_SET_NON_WRITABLE 9008


/************************* DOMES ***************************
 * Edw orizontai oi domes pou prokeitai na xrhsimopoih9oun *
 ***********************************************************/

typedef struct _DeviceIdStruct {
	char *manufactorer;
	char *OUI;
	char *productClass;
	char *serialNumber;
} DeviceIdStruct;

typedef struct _EventStruct {
	char *eventCode;
} EventStruct;

typedef struct _EventList {
	EventStruct *events;
	unsigned int size;
} EventList;

typedef struct _DateTime {
	unsigned int year;
	unsigned int month;
	unsigned int day;
	unsigned int hour;
	unsigned int min;
	unsigned int sec;
} DateTime;

typedef struct _ParameterValueStruct {
	char *name;
	char *value;
	
} ParameterValueStruct;

typedef struct _ParameterValueList {
	ParameterValueStruct *parameters;
	unsigned int size;
} ParameterValueList;

typedef struct _StringList {
	char **strings;
	unsigned int size;
} StringList;

typedef struct _SoapHeader {
	char *id;
	short holdRequests;
	short noMoreRequests;
} SoapHeader;

typedef struct _SoapMessage {
	SoapHeader *header;
	unsigned short type;
	IXML_Node *message;
} SoapMessage;


typedef struct _StateVariable {
	char *name;
	void (*getfun)(ParameterValueList *);
	void (*setfun)(ParameterValueList *);
	short int writable;
} StateVariable;


StateVariable *getStateVariable(char *);

char *respondTo(char *req);

int handleSetParameterValues(ParameterValueList *parameterList); 
int handleGetParameterValues(ParameterValueList *parameterList); 

IXML_Document *createCPEInform(void);



#endif //_CLIENT_H


